﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace psafth.AMB
{
    public class GetTime
    {
        /// <summary>
        /// Decoder Real-Time-Clock
        /// </summary>
        public DateTime RTCTime
        {
            get;
            set;
        }

        /// <summary>
        /// Coordinated Universal Time (Local time)
        /// NOTE: Only available when using gps-module connected to the decoder.
        /// </summary>
        public DateTime UTCTime
        {
            get;
            set;
        }


        public GetTime(List<DataRowObject> fieldOfRecords)
        {
            foreach (DataRowObject record in fieldOfRecords)
            {
                switch (record.DataType)
                {
                    case (int)AMBGetTimeFOR.RTC_TIME:
                        this.RTCTime = AMBCalculator.GetPassingTime(record.Data);
                        break;

                    case (int)AMBGetTimeFOR.UTC_TIME:
                        this.UTCTime = AMBCalculator.GetPassingTime(record.Data);
                        break;

                }
            }
        }
    }
}
